<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Form Layouts</title>
    <?php $this->load->view('library/header');?>
</head>

<body class="sticky-header">

<section>
    <?php $this->load->view('library/left');?>
    <div class="main-content" >
        <div class="zhezhao"></div>
        <?php $this->load->view('library/top');?>
        <div class="page-heading">
            <h3>新品数据</h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class=""> Forms Layouts </li>
            </ul>
        </div>
        
<section class="wrapper">
    <section class="panel">

        <header class="panel-heading custom-tab turquoise-tab">
            <ul class="nav nav-tabs">
                <li class="">
                    <a href="<?php echo base_url('Order/order_five_sum');?>" >新商品订单</a>
                </li>
                <li class="">
                    <a href="<?php echo base_url('Order/new_goods_list');?>" >保存商品</a>
                </li>
            </ul>
        </header>
        <div class="panel-body">
                    <div class="padding-left">
                        <form class="form-horizontal bucket-form" method="get">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">站点:</label>

                                        <div id="form_web" class="col-sm-11 slide-toggle">
                                            <div class="icheck minimal">
                                            <div class="checkbox single-row all_web_id">
                                                <input type="checkbox" <?php echo (count($param['web_id']) == count($siteweb) || count($param['web_id']) == 0) ? 'checked ' : '';?> value="<?php echo count($siteweb);?>"  >
                                                <label>全部</label>
                                            </div>
                                            <?php if ($param['web_id']): ?>
                                                <?php foreach ($siteweb as $web_id => $siteweb):?>
                                                    <div class="checkbox single-row web_ids">
                                                        <input type="checkbox" name="web_id[]" <?php echo in_array($web_id, $param['web_id']) ? 'checked' : '';?> value="<?php echo $web_id;?>"  >
                                                        <label><?php echo $siteweb; ?></label>
                                                    </div>
                                                <?php endforeach;?>
                                            <?php else:?>
                                            <?php foreach ($siteweb as $web_id => $siteweb):?>
                                                <div class="checkbox single-row web_ids">
                                                    <input type="checkbox" name="web_id[]" checked value="<?php echo $web_id;?>"  >
                                                    <label><?php echo $siteweb; ?></label>
                                                </div>
                                            <?php endforeach;?>
                                            <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-1">
                                    <button type="submit" class="btn btn-info">搜索</button>
                                </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
        <div class="panel-body">
            <div class="tab-content">
                <div class="tab-pane active" id="whole">
                    <?php $this->load->view('library/search');?>
                <section class="panel">
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped" id="dynamic-table">
                                    <tr>
                                        <th width="3%">商品图片</th>
                                        <th width="3%">商品货号</th>
                                        <th width="3%">总数量</th>
                                        <th width="10%">上架站点（sku）</th>
                                        <th width="9%">站点总销量</th>
                                        <th width="3%">数据列表</th>
                                        <th width="2%">本星期</th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24))?></th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24*2))?></th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24*3))?></th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24*4))?></th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24*5))?></th>
                                        <th width="2%"><?php echo date('m-d',time()-(60*60*24*6))?></th>
                                        <th width="3%">操作</th>
                                    </tr>
                                        <?php foreach($order_list as $k=>$item){?>
                                            <tr class="gradeX">
                                                <td>
                                                    <img style="width: 100px;" class="img" src="<?php echo $item['original_img'];?>" />
                                                </td>
                                                
                                                <td>
                                                    <?php echo $item['goods_sn'];?>
                                                </td>
                                                <td>
                                                    <?php echo $item['count_number'];?>件
                                                </td>
                                                <td>
                                                    <?php foreach($item['web_sum'] as $key=>$val){?>
                                                        <p>站点：<?php echo $key?> 销量：（<?php echo $val?>件）
                                                        </p>
                                                    <?php }?>
                                                </td>
                                                <td>
                                                    <?php foreach($item['sku_sum'] as $key=>$val){?>
                                                        <p><?php echo $key;?>销量：<?php echo $val;?>件</p>
                                                    <?php }?>
                                                </td>
                                                <td>浏览量<br>加车率<br>转化率<br>销量</td>
                                                <td><?php echo $item['本星期']['detail_views_count'];?><br>
                                                    <?php echo $item['本星期']['adds_cart_count']?><br>
                                                    <?php echo $item['本星期']['rate_count']?><br>
                                                    <?php echo $item['本星期']['item_quantity_count']?></td>
                                                <td>
                                                    <?php echo $item['近1天']['detail_views'];?><br>
                                                    <?php echo $item['近1天']['adds_cart']?><br>
                                                    <?php echo $item['近1天']['rate']?><br>
                                                    <?php echo $item['近1天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <?php echo $item['近2天']['detail_views']?><br>
                                                    <?php echo $item['近2天']['adds_cart']?><br>
                                                    <?php echo $item['近2天']['rate']?><br>
                                                    <?php echo $item['近2天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <?php echo $item['近3天']['detail_views']?><br>
                                                    <?php echo $item['近3天']['adds_cart']?><br>
                                                    <?php echo $item['近3天']['rate']?><br>
                                                    <?php echo $item['近3天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <?php echo $item['近4天']['detail_views']?><br>
                                                    <?php echo $item['近4天']['adds_cart']?><br>
                                                    <?php echo $item['近4天']['rate']?><br>
                                                    <?php echo $item['近4天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <?php echo $item['近5天']['detail_views']?><br>
                                                    <?php echo $item['近5天']['adds_cart']?><br>
                                                    <?php echo $item['近5天']['rate']?><br>
                                                    <?php echo $item['近5天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <?php echo $item['近6天']['detail_views']?><br>
                                                    <?php echo $item['近6天']['adds_cart']?><br>
                                                    <?php echo $item['近6天']['rate']?><br>
                                                    <?php echo $item['近6天']['item_quantity']?>
                                                </td>
                                                <td>
                                                    <button class="btn btn-info new_goods" data-goods_id="<?php echo $item['goods_id']?>">保存商品</button>
                                                </td>
                                            </tr>
                                        <?php }?>
                                    </tbody>
                                </table>
                            </div>
                            <div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <ul>
                                            <?php echo $pages;?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
                
            </div>

        </div>
        </div>
    </section>
</section>
        <footer>
            2014 &copy; AdminEx by
        </footer>
    </div>
</section>
<?php $this->load->view('library/footer');?>
</body>
</html>
<script src="/public/js/scripts.js"></script>
<script>
    $('.all_web_id input').click(function(){
        if($(this).is(':checked') == true){
            $('.web_ids input').each(function(){
                $(this).attr("checked",true)
            }) 
        }else{
            $('.web_ids input').each(function(){
                $(this).attr("checked",false)
            })
        }
        
    })
    $('.new_goods').click(function(){
        var goods_id = $(this).data('goods_id');
        var url = '<?php echo base_url('Order/new_goods')?>';
        $.ajax({
            type:'post',
            url:url,
            dataType:'json',
            data:{
                goods_id:goods_id
            },
            success:function(data){
                swal({
                    title:   data.info,
                    text: '2秒后关闭',
                    type: data.status,
                    allowOutsideClick: false,
                    timer: 1500,
                    showConfirmButton: false
                });
            }
        })
    })
</script>
